package com.gxnualbert.mybatisplusDemo.service;

import com.gxnualbert.mybatisplusDemo.entity.User;
import com.gxnualbert.mybatisplusDemo.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @auther gxnualbert
 * @create 2021-05-17-23:13
 */
@Slf4j
@Service
public class Person {

    @Autowired
    private UserMapper userMapper;

    public int add(String name, int age ){
        User userOneby = new User();
        userOneby.setName(name);
        userOneby.setAge(age);
        userOneby.setEmail("chenhi@baomidou.com");
        int result = userMapper.insert(userOneby);
        log.info("数据插入后，返回结果：{}", result );
        return result;
    }
}
